<?php
class udelight extends CI_Model {

    var $title   = '';
    var $content = '';
    var $date    = '';

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }
    
	function is_check_box($table,$field,$id1,$id2)
	{
		$sql ="select count(*) as c from $table where register_id = $id1 and  $field=$id2";
		$c =$this->db->query($sql)->result_array();
		if($c[0]["c"]>0)
		{
			return true;
		}
		else {
			
			return  FALSE;
		}
	}
	
	function is_chek_radio($id1,$id2)
	{
		if($id1==$id2)
		{
			return true;
		}
		else
		{
			return FALSE;
		}
	}
	
	function get_code()
	{
			$project_code =$this->config->config["project_code"];
			$rows =$this->db->query("select * from tag_runno where project_code = $project_code")->result_array();
			$this->db->query("update tag_runno set run_no = run_no+1 where project_code=$project_code");
			return $project_code."-".date("y").date("m").date("d")."C".str_pad($rows[0]['run_no'],4,0,STR_PAD_LEFT);
	
	}
}